<template>
  <div class="products">
    <Header />
    <div class="products-container">
      <h2>产品介绍</h2>
      <p class="subtitle">为您推荐最新款小米手机</p>
      <div class="product-grid">
        <div v-for="(product, index) in products" :key="index" class="product-item">
          <img :src="product.image" :alt="product.name">
          <div class="product-info">
            <h3>{{ product.name }}</h3>
            <p class="description">{{ product.description }}</p>
            <p class="price">{{ product.price }}</p>
            <button class="buy-btn">立即购买</button>
          </div>
        </div>
      </div>
    </div>
    <Footer />
  </div>
</template>

<script setup>
import { ref } from 'vue';
import Footer from '../components/Footer.vue';
import Header from '../components/Header.vue';

const products = ref([
  {
    name: '小米14 Pro',
    description: '第二代骁龙8 移动平台｜徕卡光学全焦段四摄',
    price: '¥4999起',
    image: '/images/15pro.png'
  },
  {
    name: '小米14',
    description: '第二代骁龙8 移动平台｜徕卡双摄｜超窄边屏幕',
    price: '¥3999起',
    image: '/images/14pro.png'
  },
  {
    name: 'Redmi K70 Pro',
    description: '第二代骁龙8 移动平台｜2K 高光屏｜索尼IMX890',
    price: '¥3299起',
    image: '/images/15pro.png'
  },
  {
    name: 'Redmi K70',
    description: '骁龙8 Gen 2｜1.5K 高光屏｜索尼IMX800',
    price: '¥2499起',
    image: '/images/14pro.png'
  },
  {
    name: 'Redmi Note 13 Pro',
    description: '天玑7200-Ultra｜1.5K OLED直屏｜6400万像素',
    price: '¥1799起',
    image: '/images/15pro.png'
  }
]);
</script>

<style scoped>
.products {
  text-align: center;
  padding-top: 60px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.products-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 20px;
  flex: 1;
}

h2 {
  font-size: 32px;
  color: #333;
  margin-bottom: 10px;
}

.subtitle {
  color: #666;
  font-size: 16px;
  margin-bottom: 40px;
}

.product-grid {
  display: flex;
  flex-direction: column;
  gap: 30px;
}

.product-item {
  display: flex;
  align-items: center;
  background: #fff;
  border-radius: 12px;
  padding: 30px;
  box-shadow: 0 2px 15px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.product-item:hover {
  transform: translateY(-5px);
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.15);
}

.product-item img {
  width: 300px;
  height: 300px;
  object-fit: cover;
  border-radius: 8px;
  margin-right: 40px;
}

.product-info {
  flex: 1;
  text-align: left;
}

.product-info h3 {
  font-size: 24px;
  color: #333;
  margin: 0 0 10px;
}

.description {
  color: #666;
  font-size: 16px;
  margin: 10px 0;
  line-height: 1.6;
}

.price {
  color: #ff6700;
  font-size: 24px;
  font-weight: bold;
  margin: 15px 0;
}

.buy-btn {
  background-color: #ff6700;
  color: white;
  border: none;
  padding: 12px 30px;
  border-radius: 6px;
  font-size: 16px;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

.buy-btn:hover {
  background-color: #f85000;
}

@media (max-width: 768px) {
  .product-item {
    flex-direction: column;
    padding: 20px;
  }

  .product-item img {
    width: 100%;
    height: auto;
    margin-right: 0;
    margin-bottom: 20px;
  }

  .product-info {
    text-align: center;
  }
}
</style>
